package ihm;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import javax.swing.JDialog;

import visualisationRadar.VisualisationRadar;

public class FenetreZoom extends JDialog implements MouseListener,MouseMotionListener {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1008514289489641144L;
	private VisuZoom pzoom;
	static final int tailleZoom=150;
	static final int facteurZoom=3;
	private boolean choixZoom=false;
	
	//private Radar radar;
	
	public FenetreZoom(VisualisationRadar visualisationRadar)
	{
		super();
		//this.radar=radar;
		pzoom=new VisuZoom(visualisationRadar);
		add(pzoom);
		setSize(tailleZoom*facteurZoom,tailleZoom*facteurZoom);
		setTitle("Loupe");
		setLocation(600,100);
		pack();
	}

	public VisuZoom getPzoom() {
		return pzoom;
	}

	@Override
	public void mouseDragged(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseMoved(MouseEvent e) {
		
		if (!choixZoom && isVisible()){
			this.getPzoom().miseAJourZoom(e);	
		}
	}

	@Override
	public void mouseClicked(MouseEvent e) {
		if (isVisible())
			choixZoom=!choixZoom;
	}

	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	public boolean getChoixZoom() {
		return choixZoom;
	}

	public int getZoomX() {
		return pzoom.getZoomX();
	}

	public int getZoomY() {
		return pzoom.getZoomY();
	}

	public void repeindre() {
		pzoom.miseAJourZoom();
	}		


}
